package com.doit.day05

object _02_剩下的算子 {
  def main(args: Array[String]): Unit = {
    val tuples: List[(Int, String)] = List((1, "zss"), (1, "lss"), (3, "ww"), (4, "zl"), (5, "tq"))

    //我想获取id最大的那个元素
    //    tuples.sortBy(-_._1).take(1)
    val tuple: (Int, String) = tuples.maxBy(_._1)

    //filter
    tuples.find(tp => tp._1 == 1).foreach(println)


    val map: Map[Int, String] = Map((1, "zss"), (2, "lss"), (3, "ww"), (4, "zl"), (5, "tq"))
    map.map(tp => {

    })

    val intToString: Map[Int, String] = map.mapValues(value => {
      value.toUpperCase()
    })

    intToString.foreach(println)

    val list1: List[Int] = List(1, 2, 3, 4, 6, 7, 8, 9, 10)
    val list2: List[Int] = List(5, 2, 6, 4)

    val iterator: Iterator[List[Int]] = list1.sliding(2)
    iterator.foreach(println)

    val ints: List[Int] = list1.slice(4, 6)//[)
    println(ints)














    //做拉链
    /*  val tuples1: List[(Int, Int)] = list1.zip(list2)
      tuples1.foreach(println)

      val index: List[(Int, Int)] = list1.zipWithIndex
      index.foreach(println)*/

    /*
        val ints: List[Int] = list1.intersect(list2)
        println(ints)
        val ints1: List[Int] = list1.union(list2)//不会去重，单纯的将两个集合拼接在一起
        println(ints1)
        val ints2: List[Int] = list1.diff(list2)
        println(ints2)
    */


  }
}
